package com.scenery;

import net.hainan.chat.LvyouActivity;
import net.hainan.chat.Openfire;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.scenery.services.UserServices;
import com.scenery.util.HttpUtil;
import com.scenery.util.Loger;
/**
 * 主界面
 * */
public class MainActivity extends Activity {
	/** Called when the activity is first created. */
	String TAG;
	/****景点查询****/
	Button selectButton; 
	
	Button baiduMapButton;// 百度查询
	Button loginButton, registButton,dianpingButton,friendButton;// 登陆

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		selectButton = (Button) findViewById(R.id.selectButton);
		baiduMapButton = (Button) findViewById(R.id.baiduMapButton);
		registButton = (Button) findViewById(R.id.registButton);
		loginButton = (Button) findViewById(R.id.loginButton);
		dianpingButton= (Button) findViewById(R.id.dianpingButton);
		friendButton=(Button)findViewById(R.id.friendButton);
		Button btnChat = (Button) findViewById(R.id.btnChat);//实例化按钮
		if(!HttpUtil.isNetWorkConnected(MainActivity.this))
		{
			Toast.makeText(MainActivity.this, "网络不通！", Toast.LENGTH_LONG).show();
		}
		selectButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Loger.d(TAG, "onClick");
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, SelectActivity.class);
				startActivity(intent);
			}
		});
		baiduMapButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, PoiSearch.class);
				startActivity(intent);
			}
		});
		registButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, Register.class);
				startActivity(intent);
			}
		});
		loginButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, LoginActivty.class);
				startActivity(intent);
			}
		});
		dianpingButton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, DianPingActivity.class);
				startActivity(intent);
			}
		});
		friendButton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Log.d(TAG, "friendButton onClick");
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, UserFriendActivity.class);
				startActivity(intent);
				
				//UserServices.friend("zhao");
			}
		});
		  btnChat.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this,Openfire.class);//跳转页面
				startActivity(intent);
			}
		});
	}
}